<?php

namespace App\Http\Middleware;

use App\Exceptions\GeneralException;
use Closure;

class AppImportantMaintain
{
    /**
     * Description: Handle an incoming request.
     * Author: Gxs
     * @param $request
     * @param Closure $next
     * @return mixed
     * @throws GeneralException
     */
    public function handle($request, Closure $next)
    {
        $switch = config('switch.app.important');
        if ('down' === $switch) {
            throw new GeneralException('尊敬的用户，目前服务器正在升级，可能会影响部分服务，对您带来的不便敬请原谅！');
        }
        return $next($request);
    }
}
